package com.kaifamiao.www.demo.Do29.am;

public class Demo03 {
    public static void main(String[] args) {
        Pet pet = new HSQDog();
        Dog g = (Dog) pet;
        Pet pet1 = new Cat();
        System.out.println(Dog.class);//获得类名  class和getClass
        System.out.println(pet.getClass());
        System.out.println(pet1.getClass());
        if(pet.getClass() == Dog.class){
            Dog dog = (Dog) pet;
            dog.lookDoor();
        }
    }
}
